<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<jsp:include page="../common/common.jsp" />
<script>
var OptLstTxt = new Array;
var OptLstVal = new Array;
var OptLen = 0;
function NoDupl(SelObjFrom, SelObjTo) {
var OldToVal = SelObjTo.options[SelObjTo.selectedIndex].value;
if (OptLen == 0) {
OptLen = SelObjFrom.length;
for (var i = 1; i < OptLen; i++) {
OptLstTxt[i] = SelObjFrom.options[i].text;
OptLstVal[i] = SelObjFrom.options[i].value;
   }
}
var j = 1;
for (var i = 1; i < OptLen; i++) {
if (OptLstVal[i] != SelObjFrom.options[SelObjFrom.selectedIndex].value) {
if (j == SelObjTo.length) {
SelObjTo.options[j] = new Option(OptLstTxt[i]);
}
else {
SelObjTo.options[j].text = OptLstTxt[i];
}
SelObjTo.options[j].value = OptLstVal[i];
if (OptLstVal[i] == OldToVal) {
SelObjTo.selectedIndex = j;
}
j++;
   }
}
if (SelObjTo.length > j)
SelObjTo.options[(SelObjTo.length - 1)] = null;
}
</script>
</head>
<body class="page-header-fixed">
	<script type="text/javascript" src="${path }/layer/layer.js"></script>
	<jsp:include page="../common/header.jsp" />
	<div class="clearfix"></div>
	<div class="page-container">
		<div class="page-sidebar-wrapper"><jsp:include
				page="../common/menu.jsp" /></div>
		<div class="page-content-wrapper">
			<div class="page-content">
				<div class="row">
					<div class="col-md-12">
						<form class="form-horizontal form-row-seperated" id="form"
							action="${path}/live/save" method="post" name="MForm">
							<div class="portlet box purple">
								<div class="portlet-title">
									<div class="caption">
										<i class="fa fa-shopping-cart"></i>直播详细信息
									</div>
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left" title="返回">返回</i></a> <a
											href="javascript:location.reload();" class="btn green"><i
											class="fa fa-reply" title="重置">重置</i></a>
										<button type="button" class="btn blue save" onclick="save()">
											<i class="fa fa-check" title="保存" >保存</i>
										</button>
									</div>
								</div>
								<div class="portlet-body">
									<div class="tabbable">
										<div class="tab-content no-space">
											<div class="tab-pane active" id="tab_general">
												<div class="form-body">
													<div class="form-group">
														<label class="col-md-2 control-label">直播名称: <span
															class="required">*</span></label>
														<div class="col-md-5">
															<input type="text" id="name" name="name"
																class="form-control tags medium" value="${data.name}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">直播线路:<span
															class="required">*</span></label>
														<div class="col-md-3">
															<select id="mainid" name="mainid" class="form-control"
																onChange="NoDupl(this,document.MForm.backid)">
																<option value="">请选择</option>
																<c:forEach items="${fn:split(zlineid, ',')}" var="d2">
																	<c:forEach items="${linedata}" var="d1">
																		<c:if test="${d2==d1.id}">
																			<option value="${d1.id}"
																				<c:if test="${d1.id == data.mainid}">selected="selected" </c:if>>${d1.name}</option>
																		</c:if>
																	</c:forEach>
																</c:forEach>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">备用线路:</label>
														<div class="col-md-3">
															<select id="backid" name="backid" class="form-control"
																onChange="NoDupl(this,document.MForm.mainid)">
																<option value="">请选择</option>
																<c:forEach items="${fn:split(zlineid, ',')}" var="d2">
																	<c:forEach items="${linedata}" var="d1">
																		<c:if test="${d2==d1.id}">
																			<option value="${d1.id}"
																				<c:if test="${d1.id == data.backid}">selected="selected" </c:if>>${d1.name}</option>
																		</c:if>
																	</c:forEach>
																</c:forEach>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">开始-结束时间:<span
															class="required">*</span>
														</label>
														<div class="col-md-4" style="width:40%;">
															<div style="width:400px;"
																class="input-group input-large date-picker input-daterange"
																data-date-format="yyyy-mm-dd">
																<input type="text" class="form-control" id="fromDate"
																	name="fromDate" value="${data.fromDate}"
																	readonly="readonly"
																	onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
																<span class="input-group-addon">to</span> <input
																	type="text" class="form-control" id="toDate"
																	name="toDate" value="${data.toDate}"
																	readonly="readonly"
																	onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
															</div>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">主题:<span
															class="required">*</span></label>
														<div class="col-md-3">
															<select name="theme" id="theme" class="form-control"
																onchange="queryAllInterestClass();">
																<option value="">请选择</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">模版:<span
															class="required">*</span></label>
														<div class="col-md-3">
															<select name="template" id="template"
																class="form-control"
																onchange="queryAllInterestClass1();">
																<option value="">请选择</option>
															</select>
															<div id="im"></div>
														</div>

													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">播放状态:<span
															class="required">*</span></label>
														<div class="col-md-3">
															<select name="status" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.status}">selected="selected" </c:if>>播放片花</option>
																<option value="1"
																	<c:if test="${1 == data.status}">selected="selected" </c:if>>播放直播</option>
																<option value="2"
																	<c:if test="${2 == data.status}">selected="selected" </c:if>>播放回播</option>
															</select>
														</div>
													</div>
													<input type="hidden" id="background" name="background"
														class="form-control" value="${data.background}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">视频封面:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 315px; height: 180px;">
																	<img src="${data.background}">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 315px; max-height: 180px;"></div>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span> <input
																		type="file" id="file" name="file" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>建议图片大小760x428
															</div>
														</div>
													</div>
													<input type="hidden" id="videologo" name="videologo"
														class="form-control" value="${data.videologo}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">顶部logo:<span
															class="required">*</span></label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 315px; height: 38px;">
																	<img src="${data.videologo}">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 315px; max-height: 38px;"></div>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span> <input
																		type="file" id="file1" name="file1" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>建议图片大小750*68
															</div>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">直播描述:<span
															class="required">*</span> </label>
														<div class="col-md-8">
															<input id="context" type="hidden" name="context">
															<script id="editor" type="text/plain"
																style="height:200px;">${data.context}</script>
														</div>
													</div>
													
													<div class="form-group">
														<label class="col-md-2 control-label">（如果没有不要填）直播描述2:</label>
														<div class="col-md-8">
															<input id="context2" type="hidden" name="context2">
															<script id="editor1" type="text/plain"
																style="height:200px;">${data.context2}</script>
														</div>
													</div>
													
														
													<div class="form-group">
														<label class="col-md-2 control-label">（如果没有不要填）直播描述3:</label>
														<div class="col-md-8">
															<input id="context3" type="hidden" name="context3">
															<script id="editor3" type="text/plain"
																style="height:200px;">${data.context3}</script>
														</div>
													</div>
													
															
													<div class="form-group">
														<label class="col-md-2 control-label">（如果没有不要填）直播描述4:</label>
														<div class="col-md-8">
															<input id="context4" type="hidden" name="context4">
															<script id="editor4" type="text/plain"
																style="height:200px;">${data.context4}</script>
														</div>
													</div>
													<%--<div class="form-group"
														style="background-color: #852b99;height: 30px;">
														<span style="color: #fff;">直播设置</span>
													</div> --%>
													<div class="form-group">
														<label class="col-md-2 control-label">强制关注:</label>
														<div class="col-md-3">
															<select name="attention" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.attention}">selected="selected" </c:if>>是</option>
																<option value="1"
																	<c:if test="${1 == data.attention}">selected="selected" </c:if>>否</option>
															</select>
														</div>
													</div>
														<div class="form-group">
														<label class="col-md-2 control-label">直播类型（选择是免费，收费，授权）:</label>
														<div class="col-md-3">
															<select name="ispay" class="form-control"  onchange="ckpay(this)">
																	<option value="0"
																	<c:if test="${'0' == data.ispay}">selected="selected" </c:if>>免费</option>
																<option value="1"
																	<c:if test="${'1' == data.ispay}">selected="selected" </c:if>>收费</option>
																	<option value="2"
																	<c:if test="${'2' == data.ispay}">selected="selected" </c:if>>密码授权</option>
																		<option value="3"
																	<c:if test="${'3' == data.ispay}">selected="selected" </c:if>>审核授权</option>
															</select>
														</div>
													</div>
													<div class="form-group"  style="display: none;"  id="divpay">
														<label class="col-md-2 control-label">需要支付的金额: <span
															class="required">*</span></label>
														<div class="col-md-5">
															<input type="text" id="paySum" name="paySum"
																class="form-control tags medium" value="${data.paySum}" />
														</div>
													</div>
													<div class="form-group"  style="display: none;"  id="divsh">
														<label class="col-md-2 control-label">授权说明输入框: <span
															class="required">*</span></label>
														<div class="col-md-5">
															<input type="text" id="shexplain" name="shexplain"
																class="form-control tags medium" value="${data.shexplain}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">显示在线人数:</label>
														<div class="col-md-3">
															<select name="isnumber" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.isnumber}">selected="selected" </c:if>>是</option>
																<option value="1"
																	<c:if test="${1 == data.isnumber}">selected="selected" </c:if>>否</option>
															</select>
														</div>
													</div>
												<div class="form-group">
														<label class="col-md-2 control-label">直播级别:</label>
														<div class="col-md-3">
															<select name="liveLevel" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.liveLevel}">selected="selected" </c:if>>没有级别</option>
																<option value="1"
																	<c:if test="${1 == data.liveLevel}">selected="selected" </c:if>>1级 </option>
																	<option value="2"
																	<c:if test="${2 == data.liveLevel}">selected="selected" </c:if>>2级</option>
																	<option value="3"
																	<c:if test="${3 == data.liveLevel}">selected="selected" </c:if>>3级</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">初始在线人数:</label>
														<div class="col-md-5">
															<input id="number" name="number" type="text"
																class="form-control tags medium" value="${data.number}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">开启红包:</label>
														<div class="col-md-3">
															<select name="redpacket" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.redpacket}">selected="selected" </c:if>>是</option>
																<option value="1"
																	<c:if test="${1 == data.redpacket}">selected="selected" </c:if>>否</option>
															</select>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">开启打赏:</label>
														<div class="col-md-3">
															<select name="isreward" class="form-control">
																<option value="0"
																	<c:if test="${0 == data.isreward}">selected="selected" </c:if>>是</option>
																<option value="1"
																	<c:if test="${1 == data.isreward}">selected="selected" </c:if>>否</option>
															</select>
														</div>
													</div>
													<input type="hidden" id="moviurl" name="moviurl"
														class="form-control" value="${data.moviurl}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">上传片花:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 300px; height: 150px;">
																	<video controls="controls"
																		style="width: 280px; height: 130px;"
																		src="${data.moviurl}"  class="moviurl" poster="${data.background}">
																	</video>
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 300px; max-height: 150px;"></div>
																		<c:if test="${data.moviurl!=null&&data.moviurl!=''}">	
																	<a href="#"  onclick="rmimg('moviurl')" class="btn default"
																		data-dismiss="fileinput"> 移除片花 </a>
																		</c:if>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择视频 </span> <span
																		class="fileinput-exists"> 修改视频 </span> <input
																		type="file" id="file2" name="file2" accept=".mp4"/>
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除视频 </a>
																		<a href="javascript:img2();" class="btn default fileinput-exists">上传视频 </a>
																</div>建议视频大小1280*720(注:200M以内的MP4文件)
															</div>
														</div>
													</div>
													<input type="hidden" id="adurl" name="adurl"
														class="form-control" value="${data.adurl}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">3秒广告设置:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 215px; height: 382px;">
																	<img src="${data.adurl}"  class="adurl">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 215px; max-height: 382px;"></div>
																		<c:if test="${data!=null&&data.adurl!=''}">	
																	<a href="#"  onclick="rmimg('adurl')" class="btn default"
																		data-dismiss="fileinput"> 移除图片 </a>
																		</c:if>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span> <input
																		type="file" id="file3" name="file3" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>建议图片大小750*1250
															</div>
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">上传回顾:</label>
														<div class="col-md-5">
															<input id="backmoviurl" name="backmoviurl" type="text"
																class="form-control tags medium"
																value="${data.backmoviurl}" />
														</div>
													</div>
													<div class="form-group">
														<label class="col-md-2 control-label">分享描述:</label>
														<div class="col-md-5">
															<input id="description" name="description" type="text"
																class="form-control tags medium"
																value="${data.description}" />
														</div>
													</div>
													<input type="hidden" id="shareurl" name="shareurl"
														class="form-control" value="${data.shareurl}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">分享图片:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 200px; height: 200px;">
																	<img src="${data.shareurl}"  class="shareurl">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 200px; max-height: 200px;"></div>
																<c:if test="${data!=null&&data.shareurl!=''}">	
																	<a href="#"  onclick="rmimg('shareurl')" class="btn default"
																		data-dismiss="fileinput"> 移除图片 </a>
																		</c:if>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span>  <input
																		type="file" id="file4" name="file4" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>建议图片大小200*200
															
															</div>
														</div>
													</div>
													<%--<input type="hidden" id="inviteurl" name="inviteurl"
														class="form-control" value="${data.inviteurl}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">邀请图片:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 300px; height: 150px;">
																	<img src="${data.inviteurl}">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 300px; max-height: 150px;"></div>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span> <input
																		type="file" id="file5" name="file5" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>
															</div>
														</div>
													</div> --%>
													<input type="hidden" id="codeurl" name="codeurl"
														class="form-control" value="${data.codeurl}" />
													<div class="form-group" id="pic">
														<label class="col-md-2 control-label">二维码图片:</label>
														<div class="col-md-8">
															<div class="fileinput fileinput-new"
																data-provides="fileinput">
																<div class="fileinput-new thumbnail"
																	style="width: 200px; height: 200px;">
																	<img src="${data.codeurl}">
																</div>
																<div
																	class="fileinput-preview fileinput-exists thumbnail"
																	style="max-width: 200px; max-height: 200px;"></div>
																<div>
																	<span class="btn default btn-file"> <span
																		class="fileinput-new"> 选择图片 </span> <span
																		class="fileinput-exists"> 修改图片 </span> <input
																		type="file" id="file5" name="file5" />
																	</span> <a href="#" class="btn default fileinput-exists"
																		data-dismiss="fileinput"> 移除图片 </a>
																</div>建议图片大小280*280
															</div>
														</div>
													</div>
													
												<%-- 	<div class="form-group">
														<label class="col-md-2 control-label">二维码描述:</label>
														<div class="col-md-5">
															<input id="codedescription" name="codedescription" type="text"
																class="form-control tags medium"
																value="${data.codedescription}" />
														</div>
													</div>--%>
												</div>
											</div>
										</div>
									</div>
								</div>

								<div class="portlet-title">
									<div class="actions btn-set">
										<a href="javascript:history.go(-1);" class="btn default"><i
											class="fa fa-angle-left" title="返回">返回</i></a> <a
											href="javascript:location.reload();" class="btn green"><i
											class="fa fa-reply" title="重置">重置</i></a>
										<button type="button" class="btn blue save">
											<i class="fa fa-check" title="保存" onclick="save()">保存</i>
										</button>
									</div>
								</div>
							</div>
							<input type="hidden" id="id" name="id" value="${data.id}">
							<input type="hidden" id="userid" name="userid" value="${data.userid}">
							<input type="hidden" id="mainname" name="mainname" value="${data.mainname }">
							<input type="hidden" id="backname" name="backname" value="${data.backname }">
							<input type="hidden" id="liveurl" name="liveurl" value="${data.liveurl }">
							<input type="hidden" id="zburl" name="zburl" value="${data.zburl }">
							<input type="hidden" id="currentStatus" name="currentStatus" value="${data.currentStatus }">
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="../common/footer.jsp" />
	<script type="text/javascript"
		src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
	<script type="text/javascript"
		src="${path}/assets/scripts/biz/ajaxfileupload.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/ueditor.config.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="${path}/operate/js/live.js"></script>
	<script type="text/javascript"
		src="${path}/assets/plugins/calendar/WdatePicker.js"></script>
	<script>
		var editor;
		var editor1;
		var editor3;
		var editor4;
		$(function() {
			editor = UE.getEditor('editor');
			editor1 = UE.getEditor('editor1');
			editor3 = UE.getEditor('editor3');
			editor4 = UE.getEditor('editor4');
			if (${null != data.id}) { //修改
				queryAllKindergarten(${data.theme});
				queryAllInterestClass(${data.template});

			} else {
				queryAllKindergarten();
			}
			
			var ipay='${data.ispay}';
			if(ipay=='1'){
				$("#divpay").show();
			}else if(ipay==3){
				$("#divsh").show();
			}
		});
		function save() {
			var context = editor.getContent();
			var context1 = editor1.getContent();
			var context3 = editor3.getContent();
			var context4 = editor4.getContent();
			if ($("#name").val() == "") {
				layer.alert("直播名称不能为空!");
				return;
			}
			if ($("#fromDate").val() == "") {
				layer.alert("直播开始时间不能为空!");
				return;
			}
			if ($("#toDate").val() == "") {
				layer.alert("直播结束时间不能为空!");
				return;
			}
			if ($("#mainid").val() == "") {
				layer.alert("直播线路不能为空!请联系管理员购买线路!");
				return;
			}
			if ($("#theme").val() == "") {
				layer.alert("主题不能为空!");
				return;
			}
			if ($("#template").val() == "") {
				layer.alert("模版不能为空!");
				return;
			}
			if ($("#file1").val() == ""&& $("#videologo").val() == "") {
				layer.alert("顶部logo不能为空!");
				return;
			}
			if (!/[\w\W]+/.test(context)) {
				layer.alert("直播描述不能为空!");
				return;
			}
			$("#context").val(context);
			$("#context2").val(context1);
			$("#context3").val(context3);
			$("#context4").val(context4);
			img();
		}
		function img() {

			if ($("#file").val() != "") {
				if (checkTypes('file')) {
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#background").val(data.uri);

								img1();
							}
						}
					});
				} else {
					layer.alert("视频封面请上传jpg、jpeg、png、bmp、gif格式的图片");
				}
			} else {
				img1();
			}
		}
		function img1() {
			if ($("#file1").val() != "") {
				if (checkTypes('file1')) {
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file1',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#videologo").val(data.uri);
								img3();
							}
						}
					});
				} else {
					layer.alert("顶部logo请上传jpg、jpeg、png、bmp、gif格式的图片");
				}
			} else {
				
				img3();
			}
		}
		function img3() {
			if ($("#file3").val() != "") {
				if (checkTypes('file3')) {
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file3',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#adurl").val(data.uri);
								img4();
							}
						}
					});
				} else {
					layer.alert("广告请上传jpg、jpeg、png、bmp、gif格式的图片");
				}
			} else {
				img4();
			}
		}
		function img4() {
			if ($("#file4").val() != "") {
				if (checkTypes('file4')) {
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file4',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#shareurl").val(data.uri);
								img5();
							}
						}
					});
				} else {
					layer.alert("分享图片请上传jpg、jpeg、png、bmp、gif格式的图片");
				}
			} else {
				img5();
			}
		}
		function img5() {
			if ($("#file5").val() != "") {
				if (checkTypes('file5')) {
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file5',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#codeurl").val(data.uri);
								$("#form").submit();
							}
						}
					});
				} else {
					layer.alert("广告请上传jpg、jpeg、png、bmp、gif格式的图片");
				}
			} else {
				//加载层-风格4
				layer.msg('保存中请稍等！', {
					icon : 16,
					shade : 0.1
				});
				$("#form").submit();
			}
		}
		function img2() {
			if ($("#file2").val() != "") {
				if (checkTypes1('file2')) {
					//加载层-风格4
					layer.msg('上传中请稍等！', {
						icon : 16,
						time: 600000,
						shade : 0.1
					});
					$.ajaxFileUpload({
						url : '${path}/conf/upload',
						async : false,
						secureuri : false,
						fileElementId : 'file2',
						dataType : 'json',
						success : function(data, status) {
							if (data.statusCode == 200) {
								$("#moviurl").val(data.uri);
								layer.alert("上传成功!");
								return;
							}else{
								layer.alert("上传失败!");
							}
						}
					});
				} else {
					layer.alert("片花请上传mp4格式的视频");
				}
			}
		}
		//检测图片是否符合规范
		function checkTypes(id) {
			var File_box = document.getElementById(id);
			var extend = File_box.value.substring(File_box.value
					.lastIndexOf(".") + 1);
			if (extend == "jpg" || extend == "png" || extend == "jpeg"
					|| extend == "bmp" || extend == "gif") {
				return true;
			}

		}
		//检测视频是否符合规范
		function checkTypes1(id) {
			var File_box = document.getElementById(id);
			var extend = File_box.value.substring(File_box.value
					.lastIndexOf(".") + 1);
			if (extend == "mp4") {
				return true;
			}

		}
		
		function ckpay(em){
		
			if($(em).val()==1){
				$("#divpay").show();
			}else if($(em).val()==3){
				$("#divsh").show();
			}else{
				$("#divsh").hide();
				$("#divpay").hide();
			}
		}
		
		function rmimg(id){
			$("#"+id).val("");
			$("."+id).attr("src","");
		}
	</script>
	
</body>
</html>